package com.sixth.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sixth.dao.ShopkeeperchangeDao;
import com.sixth.entity.Shopkeeperchange;
import com.sixth.service.ShopkeeperchangeService;
import com.sixth.util.TableLayUi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: project01
 * @description:
 * @author: 高振杨
 * @create: 2021-12-20 21:34
 **/
@Service
public class ShopkeeperchangeServiceImpl implements ShopkeeperchangeService {
    @Autowired
    private ShopkeeperchangeDao shopkeeperchangeDao;
    //查询全部调动信息
    public TableLayUi getall(int page, int limit,String timeFrame) {
        String starttime = null;
        String endtime = null;
        PageHelper.startPage(page,limit);
        if (timeFrame!=null&&timeFrame!="") {
            starttime = timeFrame.substring(0,19);
            endtime = timeFrame.substring(22,timeFrame.length());
        }
        List<Shopkeeperchange> all = shopkeeperchangeDao.getAll(starttime, endtime);
        PageInfo<Shopkeeperchange> pageInfo = new PageInfo<Shopkeeperchange>(all);
        return new TableLayUi(0,"",pageInfo.getTotal(),pageInfo.getList());
    }
}
